/* ************************************************************************

   Copyright:

   License:

   Authors:

************************************************************************ */

qx.Theme.define("bip.theme.Appearance",
{
  extend : qx.theme.modern.Appearance,

  appearances :
  {
  	/*
    ---------------------------------------------------------------------------
      APPLICATION
    ---------------------------------------------------------------------------
    */
  	"application": "atom",
    
  	"application/header": {
  		style : function(states)
	    {
	    	var useCSS = qx.core.Environment.get("css.borderradius") &&
	      qx.core.Environment.get("css.gradients") &&
	      qx.core.Environment.get("css.boxshadow");
	
	      var decorator = "application-header";
	      if (useCSS) {
	        decorator += "-css";
	      }
	    
	      return {
	        font : "bold",
	        textColor : "text-selected",
	        decorator : decorator
	      };
	    }
    },
    
    "application/header-local": "toolbar-button",
    
    "application/split" : {
    	style : function(states)
		    {
		      return {
		        backgroundColor:"application-end"
		      };
		    }
    },
    
    /*"application/pane" : {
    	style : function(states)
	    {
	      var useCSS = qx.core.Environment.get("css.gradients") &&
	        qx.core.Environment.get("css.borderradius");
	      return {
	        decorator : useCSS ? "application-pane-css" : "application-pane",
	        minHeight : 500
	      };
	    }
  },
  
    "application/portlets": {
    	style : function(states)
	    {
	      var useCSS = qx.core.Environment.get("css.gradients") &&
	        qx.core.Environment.get("css.borderradius");
	      return {
	        decorator : useCSS ? "application-portlet-css" : "application-pane",
	        minHeight : 500
	      };
	    }
  },*/
    
    "application/toolbar": "atom",
  	
  	
  	/*
    ---------------------------------------------------------------------------
      QUESTIONS 
    ---------------------------------------------------------------------------
    */
    
    "question-groupbox" : "groupbox",
    
    "question-groupbox/frame" :
    {
    	include: "groupbox/frame",
    	
      style : function(states)
      {
        var useCSS = qx.core.Environment.get("css.borderradius");
        return {
          padding : useCSS ? 2 : 4,
          margin : useCSS ? 1 : undefined,
          decorator : useCSS ? "group-css" : "group"
        };
      }
    },
  	
  	"question-field" : {
      style : function(states)
      {
        return {
          paddingBottom: 10
        };
      }
    },
    
    "question-field/description" : 
    {
      style : function(states)
      {
        return {
          decorator:"question-description-css",
          padding:5
        };
      }
    },
    
    "question-field/name" : 
    {
      alias : "atom",

      style : function(states)
      {
        return {
          paddingLeft   : 5,
          textColor : states.invalid ? "invalid" : "text-title",
          font      : "bold"
        };
      }
    },
    
    "answer-field-slider" : "atom",
  	"answer-field-slider/slider" : "slider",
    "answer-field-slider/slider/knob" : "scrollbar/slider/knob",
    	
    /*
    ---------------------------------------------------------------------------
      MANAGE-TOPICS
    ---------------------------------------------------------------------------
    */
  	
  	"manage-topics" : "atom",
  	"manage-topics/topics" : "list",
  	"manage-topics/button":
  	{
  		include: "button",
  		style : function(states)
        {
          return {
            center   : false,
            height : 15
          };
        }
  	},
  	
  	"manage-topics/delete-topic" : "manage-topics/button",
  	"manage-topics/insert-topic" : "manage-topics/button",
  	"manage-topics/topic-actions" : "atom", 
  	"manage-topics/topics-group" : "groupbox",
  	"manage-topics/questions-group" : "groupbox",
  	"manage-topics/questions" : "list",
  	"manage-topics/question-actions" : "atom", 
  	"manage-topics/insert-question" : "manage-topics/button",
  	"manage-topics/delete-question" : "manage-topics/button",
  	
  	
    /*
      ---------------------------------------------------------------------------
        WINDOWS
      ---------------------------------------------------------------------------
     */
  	// DIALOG
  	"wdialog" : "window",
  	
  	"wdialog/actionbar":
  	{
        style : function(states)
        {
          return {
            padding   : [ 2, 6 ],
            decorator : "window-statusbar",
            minHeight : 18
          };
        }
      },
  	
  	"wdialog/header" : 
  	{
        style : function(states)
        {
          return {
   			decorator : "window-head",
  			minHeight: 20
          };
        }
      },
  	
  	"wdialog/header-image":
  	{
        style : function(states)
        {
          return {
            opacity : !states.replacement && states.disabled ? 0.3 : 1,
  		  alignX	  : "center",
  		  alignY      : "middle",
  		  padding: 5
          }
        }
      },
  	
  	"wdialog/header-description":
  	{
        style : function(states)
        {
          return {
  		  alignX	  : "left",
            alignY      : "top",
            	paddingTop: 3,
        		  paddingLeft: 10
          };
        }
  	},
  	
  	"wdialog/header-title": 
  	{
        style : function(states)
        {
          return {
  		  textColor : "text-title",
            font      : "bold",
  		  alignX	  : "left",
  		  textAlign    : "left",
            alignY      : "top",
  		  paddingTop: 8,
  		  paddingLeft: 8
          };
        }
  	},
  	
  	"locallist":"selectbox",
  	
  	/*
    ---------------------------------------------------------------------------
      PAGE
    ---------------------------------------------------------------------------
    */
  	"page": 
  	{
      style : function(states)
      {
        var useCSS = qx.core.Environment.get("css.borderradius") &&
          qx.core.Environment.get("css.gradients") &&
          qx.core.Environment.get("css.boxshadow");

        var decorator;
        var shadow;

        if (useCSS) {
            decorator = "page-css";
        } 
        return {
          decorator : decorator,
          contentPadding : [ 10, 10, 10, 10 ],
          margin : [5, 5, 5, 3]
          
        };
      }
    },
  	
  	"page/header" :
    {
      style : function(states)
      {
        var useCSS = qx.core.Environment.get("css.borderradius") &&
          qx.core.Environment.get("css.gradients") &&
          qx.core.Environment.get("css.boxshadow");

        var decorator = "page-header";
        if (useCSS) {
          decorator += "-css";
        }

        return {
          decorator    : decorator,
          minHeight    : 26,
          paddingRight : 2
        };
      }
    },
    
    "page/actionbar":"wdialog/actionbar",
  	
  	"page/header-image": "wdialog/header-image",
  	"page/header-description":"wdialog/header-description",
  	"page/header-title": "wdialog/header-title",
    "page/captionbar" : "atom",
    
    "page/pane": "window/pane",
  	
  	
  		/*
      ---------------------------------------------------------------------------
        PORTLET
      ---------------------------------------------------------------------------
      */

      "portlet" :
      {
        style : function(states)
        {
          var useCSS = qx.core.Environment.get("css.borderradius") &&
            qx.core.Environment.get("css.gradients") &&
            qx.core.Environment.get("css.boxshadow");

          var decorator;
          var shadow;

          if (useCSS) {
              decorator = "portlet-css";
          } 
          return {
            decorator : decorator,
            contentPadding : [ 10, 10, 10, 10 ],
            margin : [5, 3, 5, 5]
            
          };
        }
      },

      "portlet/pane" :
      {
        style : function(states)
        {
          var useCSS = qx.core.Environment.get("css.borderradius") &&
            qx.core.Environment.get("css.gradients") &&
            qx.core.Environment.get("css.boxshadow");
          return {
            decorator : useCSS ? "portlet-pane-css" : "portlet-pane"
          };
        }
      },

      "portlet/captionbar" :
      {
        style : function(states)
        {
          var useCSS = qx.core.Environment.get("css.borderradius") &&
            qx.core.Environment.get("css.gradients") &&
            qx.core.Environment.get("css.boxshadow");

         // var decorator = states.active ? "window-captionbar-active" : "window-captionbar-inactive";
          var decorator = "portlet-captionbar";
          if (useCSS) {
            decorator += "-css";
          }

          return {
            decorator    : decorator,
            textColor    : "text-gray",
            minHeight    : 26,
            paddingRight : 2
          };
        }
      },

      "portlet/icon" :
      {
        style : function(states)
        {
          return {
            margin : [ 5, 0, 3, 6 ]
          };
        }
      },

      "portlet/title" :
      {
        style : function(states)
        {
          return {
            alignY      : "middle",
            font        : "bold",
            marginLeft  : 6,
            marginRight : 12
          };
        }
      },

      "portlet/statusbar" :
      {
        style : function(states)
        {
          var useCSS = qx.core.Environment.get("css.borderradius") &&
            qx.core.Environment.get("css.gradients") &&
            qx.core.Environment.get("css.boxshadow");
          return {
            padding   : [ 2, 6 ],
            decorator : useCSS ? "window-statusbar-css" : "window-statusbar",
            minHeight : 18
          };
        }
      },

      "portlet/statusbar-text" :
      {
        style : function(states)
        {
          return {
            font : "small"
          };
        }
      }



  	
    
  }
});